<?php
$root = realpath($_SERVER["DOCUMENT_ROOT"]) . "/SmartTuition/SmartTuition.Model";
// Abstraction level. Interface IUnitOfWork.
require_once("$root/Abstraction/IUnitOfWork.php");
// including DB Repositories
require_once("$root/Repositories/DB/AdminRepository.php");
require_once("$root/Repositories/DB/AuditoryRepository.php");
require_once("$root/Repositories/DB/DocumentRepository.php");
require_once("$root/Repositories/DB/DoubleLessonRepository.php");
require_once("$root/Repositories/DB/GossipRepository.php");
require_once("$root/Repositories/DB/GroupRepository.php");
require_once("$root/Repositories/DB/RoleRepository.php");
require_once("$root/Repositories/DB/ScheduleRepository.php");
require_once("$root/Repositories/DB/StudentRepository.php");
require_once("$root/Repositories/DB/SubjectRepository.php");
require_once("$root/Repositories/DB/TeacherRepository.php");
require_once("$root/Repositories/DB/UserRepository.php");
 
class DBUnitOfWork implements IUnitOfWork
{
    private $adminRepository;
    private $auditoryRepository;
    private $docsBySubjectRepository;
    private $documentRepository;
    private $doubleLessonRepository;
    private $gossipRepository;
    private $groupRepository;
    private $roleRepository;
    private $scheduleRepository;
    private $studentDocsRepository;
    private $studentRepository;
    private $subjectRepository;
    private $teacherRepository;
    private $userRepository;


    public function AdministratorRepository()
    {
        if($this->adminRepository == null ) {
            $this->adminRepository = new AdminRepository();
        }
        return $this->adminRepository;
    }

    public function AuditoryRepository()
    {
        if($this->auditoryRepository == null) {
            $this->auditoryRepository = new AuditoryRepository();
        }
        return $this->auditoryRepository;
    }

    public function DocumentRepository()
    {
        if($this->documentRepository == null ) {
            $this->documentRepository = new DocumentRepository();
        }
        return $this->documentRepository;
    }

    public function DoubleLessonRepository()
    {
        if($this->doubleLessonRepository == null) {
            $this->doubleLessonRepository  = new DoubleLessonRepository();
        }
        return $this->doubleLessonRepository;
    }

    public function GossipRepository()
    {
        if($this->gossipRepository == null) {
            $this->gossipRepository = new GossipRepository();
        }
        return $this->gossipRepository;
    }

    public function GroupRepository()
    {
        if($this->groupRepository == null) {
            $this->groupRepository = new GroupRepository();
        }
        return $this->groupRepository;
    }

    public function RoleRepository()
    {
        if ($this->roleRepository == null) {
            $this->roleRepository = new RoleRepository();
        }
        return $this->roleRepository;
    }

    public function ScheduleRepository()
    {
        if($this->scheduleRepository == null) {
            $this->scheduleRepository = new ScheduleRepository();
        }
        return $this->scheduleRepository;
    }

    public function StudentRepository()
    {
        if($this->studentRepository == null) {
            $this->studentRepository = new StudentRepository();
        }
        return $this->studentRepository;
    }

    public function SubjectRepository()
    {
        if($this->subjectRepository == null) {
            $this->subjectRepository = new SubjectRepository();
        }
        return $this->subjectRepository;
    }

    public function TeacherRepository()
    {
        if($this->teacherRepository == null) {
            $this->teacherRepository = new TeacherRepository();
        }
        return $this->teacherRepository;
    }

    public function UserRepository()
    {
        if($this->userRepository == null) {
            $this->userRepository = new UserRepository();
        }
        return $this->userRepository;
    }
}